package com.ruoyi.system.yue;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MqConfig {

    //交换机
    @Bean
    public FanoutExchange fanoutExchanges(){
        return new FanoutExchange("fanoutExchanges");
    }

    //队列
    @Bean
    public Queue querys(){
        return QueueBuilder.durable("querys").build();
    }

    //交换机和队列绑定
    @Bean
    public Binding binding(@Qualifier("querys")Queue queue, @Qualifier("fanoutExchanges")FanoutExchange fanoutExchange){
        return BindingBuilder.bind(queue).to(fanoutExchange);
    }

}
